<?php

namespace app\api\service;

use think\facade\Db;

class ResellOrderService
{
    /**
     *
     * 获取转卖商品信息
     * */
    public static function findResellGoods($id)
    {
        $goods = Db::name('user_resell_goods')
                ->alias('a')
                ->field('b.id as resell_session_id,a.goods_name,a.image,a.group_activity_id,a.group_goods_id,a.attr,a.origin_price,
                                a.resell_price,a.goods_num,a.group_num,a.is_limit_member,b.resell_goods_id,b.end_time')
                ->join('user_resell_session b','a.id=b.resell_goods_id')
                ->whereBetweenTimeField('b.start_time','b.end_time')
                ->where('a.id',$id)
                ->find();
        return $goods;
    }


    /**
     *
     * 获取用户信息
     * */
    public static function getUserInfo($user_id)
    {
        $user =  Db::name('user')->field('nickname,avatar,user_id')->where('user_id',$user_id)->find();

        return $user;
    }

}